using UnityEngine;

public class BoarChaseState : BaseState
{
  public override void OnEnter(Enemy enemy)
  {
    curEnemy = enemy;
    curEnemy.curSpeed = curEnemy.chaseSpeed;
    curEnemy.anim.SetBool("run", true);
  }

  public override void LogicUpdate()
  {
    // 如果chase超时，则切回巡逻装填
    if (curEnemy.lostTimeCounter <= 0)
      curEnemy.SwitchState(NPCState.Patrol);

    if (!curEnemy.physicCheck.isGround || curEnemy.physicCheck.touchHeadWall)
    {
      curEnemy.transform.localScale = new Vector3(curEnemy.faceDir.x, 1, 1);
    }
  }

  public override void PhysicsUpdate()
  {

  }

  public override void OnExit()
  {
    curEnemy.anim.SetBool("run", false);
  }

}
